package mo.offer_special;

public class L088 {

    public int minCostClimbingStairs(int[] cost) {
        int[] total = new int[cost.length+1];
        total[0] = 0;
        total[1] = 0;
        for (int i = 2; i <= cost.length; i++) {
            total[i] = Math.min(total[i-2]+cost[i-2], total[i-1]+cost[i-1]);
        }
        return total[total.length-1];
    }

    public static void main(String[] args) {
        L088 test = new L088();
        System.out.println(test.minCostClimbingStairs(new int[]{1, 100, 1, 1, 1, 100, 1, 1, 100, 1}));
    }

}
